<template>
	<view class="container">
		<uni-nav-bar left-icon="left" :title="title" @clickLeft="backClick" background-color="#007AFF" dark="true"></uni-nav-bar>
		<up-list>
			<up-list-item v-for="(item,homeworkId) in homeworks" :key="homeworkId" @click="homeworkClick(item,homeworkId)">
				<uni-card :title="item.title" :extra="item.statusText" :sub-title="item.deadline">
					<text>{{item.content}}</text>
				</uni-card>
			</up-list-item>
		</up-list>
	</view>
</template>
<script type="text/javascript">
export default 
     {
        data() {
            return {
                curMenu: 0,
                menuItems: [{ name: '签到' }, { name: '作业' }],
                title: '作业清单',
                homeworks: [{
                    homeworkId: 1,
                    title: '作业1',
                    content: '作业1的内容',
                    deadline: '2021-09-01',
                    status: '',
                    statusText: '未提交'
                }, {
                    homeworkId: 2,
                    title: '作业2',
                    content: '作业2的内容',
                    deadline: '2021-09-01',
                    status: 'success',
                    statusText: '已提交'
                }]
            }
        },
        onLoad() { },
        methods: {
            backClick() {
                uni.navigateBack();
            },
            menuClick(item) {
                console.log('item', item);
            },
            homeworkClick(item, homeworkId) {
                uni.navigateTo({
                    url: '/pages/homework/homework_detail?homeworkId=' + homeworkId
                });
            },
        },
    }
</script>
<style type="text/css">.container{display: flex !important;flex-direction: column}.content{display: flex !important;flex-direction: column;align-items:center;justify-content:center}.title{font-size:36rpx;color:#8f8f94}</style>